from django.conf.urls import url
from rest_framework.routers import DefaultRouter

from . import views

urlpatterns = [
    # url(r'categories/$', views.CategoryListView.as_view()),   # 首页专栏分类路由
    url(r'^categories/(?P<category_id>\d+)/newslist/$', views.NewsListView.as_view()),   # 首页新闻列表路由
    url(r'activities/', views.ActivityList2View.as_view()),  # 首页活动推荐路由
    url(r'hot_answers/', views.AnswersListView.as_view()),   # 首页热门回答路由
    url(r'meet_she/', views.MeetSheListView.as_view()),    # 首页遇见它路由
    url(r'activity_calendar/', views.ActivityCalendarListView.as_view()),  # 首页活动日历路由
    # url(r'news/(?P<news_id>\d+)/$', views.NewsDetailView.as_view()),   # 新闻详情页的展示
    url(r'authors/(?P<pk>\d+)/$', views.AuthorRecentView.as_view()),    # 新闻详情页作者动态 的展示
    url(r"hotrecommend/$", views.HotRecommendView.as_view()),    # 新闻详情业热门回答的路由
]


router = DefaultRouter()
router.register(r'news', views.NewsViewSet, base_name='new')
router.register(r'categories', views.CategoryViewSet, base_name='category')
# 添加路由 获取新闻详情get headline/news/(?P<news_id>\d+) 创建新闻　post headline/news/
urlpatterns += router.urls

